package fragments;

import mindshare.ProfileInf;
import info.androidhive.slidingmenu.R;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TabHost;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TabHost.TabSpec;
import android.widget.TextView;

public class Profile extends Fragment {
	private TabHost th;
	private View rootView;
	private Context c;
	
	public Profile(){}
	
	@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        rootView = inflater.inflate(R.layout.profile, container, false);
        c=rootView.getContext();
        Log.d("DEBUGEANDO", "USUARIOOOOOOO>>>>>>>>>>>> ");
        Log.d("DEBUGEANDO", ProfileInf.usuario.getNickname());
        Log.d("DEBUGEANDO", ProfileInf.usuario.getStudyDegree());
        Log.d("DEBUGEANDO", ProfileInf.usuario.getConocimientos().get(0));
        Log.d("DEBUGEANDO", ProfileInf.usuario.getIntereses().get(0));
        
        EditText nickname=(EditText) rootView.findViewById(R.id.etUsername);
        nickname.setText(ProfileInf.usuario.getNickname());
        
        EditText studyDegree=(EditText) rootView.findViewById(R.id.etStudy);
        studyDegree.setText(ProfileInf.usuario.getStudyDegree());
        
        // reference the table layout
        TableLayout conocimientos = (TableLayout)rootView.findViewById(R.id.conocimientosTable);
        // delcare a new row
        
        for (int i = 0; i < ProfileInf.usuario.getConocimientos().size(); i++) {
        	TableRow newRow = new TableRow(c);
        	TextView newText=new TextView(c);
        	newText.setText(ProfileInf.usuario.getConocimientos().get(i));
            newRow.addView(newText); 
            conocimientos.addView(newRow);
		}
        
     // reference the table layout
        TableLayout intereses = (TableLayout)rootView.findViewById(R.id.interesesTable);
        // delcare a new row
        
        for (int i = 0; i < ProfileInf.usuario.getIntereses().size(); i++) {
        	TableRow newRow = new TableRow(c);
        	TextView newText=new TextView(c);
        	newText.setText(ProfileInf.usuario.getIntereses().get(i));
            newRow.addView(newText); 
            intereses.addView(newRow);
		}
        
       
        
        
        
       
        return rootView;
    }
}
